<%@ Page Language="C#" Debug="true" EnableViewState="false" MasterPageFile="~/default.master"%>
<%@ import Namespace="Memories" %>
<%@ import Namespace="Memories.Entities" %>

<script runat="server">

    
	string path = "";
    Settings settings;
	string description = "";

	void Page_Init(Object sender, EventArgs e){
        settings = (Settings)Context.Items["Settings"];
        path = (string)Context.Items["Path"];

        this.Title = settings.Title;
		
        Folder Groups = MemoriesDB.GetFolder(settings);
		description = Groups.Comment;

        GroupList.DataSource = Groups.Folders;
        GroupList.DataBind();
	}

    
</script>
<asp:Content ID="Content1" ContentPlaceHolderID="PageHeader" runat="server">
    <h2><%=GetGlobalResourceObject("Localization", "home")%></h2>
</asp:Content>
<asp:Content ContentPlaceHolderID="ContentWrapper" runat="server">
		<asp:Repeater id="GroupList" runat="server" EnableViewState="false">
		    <ItemTemplate>
		    <h3><a href="<%#settings.UrlFormatter.GetFolderViewUrl((string)Eval("RelativePath"))%>"><%#Eval("Name") %></a></h3>
		        <asp:datalist runat="server" DataSource='<%# ((Folder)Container.DataItem).Folders %>' 
		             RepeatColumns="5" style="width:100%;" Cellpadding="3">
		                <ItemTemplate>
		                    <a href="<%#settings.UrlFormatter.GetFolderViewUrl((string)Eval("RelativePath"))%>"><%#Eval("Name") %></a>
		                </ItemTemplate>
		                <ItemStyle Width="20%" VerticalAlign="Top"/>
			    </asp:datalist>
		    </ItemTemplate>
			<headerTemplate>
				<asp:placeholder runat="server" visible="<%#description.Length > 0%>" >
					<div  class="comment"><%#description%></div>
				</asp:placeholder>
			</headerTemplate>
	    </asp:Repeater>
	    <p>&nbsp;</p>
</asp:Content>
	   